package com.me.modules.sys.service.impl;

import com.me.modules.sys.dao.GroupRoleDao;
import com.me.modules.sys.dao.GroupUserDao;
import com.me.modules.sys.service.GroupUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @Date : 2018/12/18 9:52
 * @Author : zhenglei
 * @Desc : 组_用户实现类
 */
@Service("groupUserService")
public class GroupUserServiceImpl implements GroupUserService {

    @Autowired
    private GroupRoleDao groupRoleDao;
    @Autowired
    private GroupUserDao groupUserDao;

    @Override
    public List<Integer> queryUserIdListByGroupId(Integer groupId) {
        return groupUserDao.queryUserIdListByGroupId(groupId);
    }

    @Override
    public List<Integer> queryGroupIdListByUserId(Integer userId) {
        return groupUserDao.queryGroupIdListByUserId(userId);
    }

    @Override
    public void save(Map<String, Object> map) {
        groupUserDao.save(map);
    }

    @Override
    public void delete(Integer id) {
        groupUserDao.delete(id);
    }

    @Override
    public void deleteBatch(String[] ids) {
        groupUserDao.deleteBatch(ids);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int groupAddUser(Map<String, Object> map) {
        return groupUserDao.groupAddUser(map);
    }

    @Override
    public int groupDeleteUser(Map<String, Object> map) {
        return groupUserDao.groupDeleteUser(map);
    }
}
